#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int main()
{
	int t = 0;
	int  N = 0;
	int N1 = 0;
	int arr[1000] = { 0 };
	int n = 0;
	scanf("%d", &N);
	N1 = N;
	for (int i = 0; i < N; i++)
	{
		scanf("%d ", &arr[i]);
	}
	scanf("%d", &n);
	for (int i = 0; i < N1; i++)
	{
		if (arr[i] == n)
		{
			t++;
			for (int j = i; j < N1 - 1; j++)
			{
				arr[j] = arr[j + 1];
			}
			i--;
			N1--;
		}
	}
	if (t == N)
	{
		printf(" ");
	}
	else
	{
		for (int i = 0; i < N1; i++)
		{
			printf("%d ", arr[i]);
		}
	}
	return 0;
}